# Load data
d3cp <- read.csv('C:\\Users\\millerry\\Downloads\\analysisTasks3.csv')
d3n <- read.csv('C:\\Users\\millerry\\Downloads\\analysisTasksNoEngage3.csv')
#d3cp <- read.csv('C:\\Users\\Ryan M\\Downloads\\analysisTasks3.csv')
#d3n <- read.csv('C:\\Users\\Ryan M\\Downloads\\analysisTasksNoEngage3.csv')
# Manually remove repeats
d3n <- d3n[-which(d3n$DaqName %in% c("20130612092744.csv", "20140104105417.csv")),]
d3cp <- d3cp[-which(d3cp$DaqName %in% c("20130612092744.csv", "20140104105417.csv")),]
Visuals
Standard deviation of lane deviation by dosage group and secondary task engagement:


Conclusions: - Not much difference when deriving engagement segment using changepoint detection vs. using entire period task is available - We can still analyze the data both ways, but will use the changepoint detection approach for now
Boxplot version:

Conclusions: - Standard Deviation of Lane Deviation is much higher when engaged in secondary task (artist-menu search) - Similar differences across experimental conditions - This visual ignores pairing of segments/participants
Paired (trt/control) version:

Conclusions: - Within each experiment condition individual subject performance is worse when engaged in secondary task
Tables
Secondary task segments available for analysis for each of the 19 subjects:
| Subject ID 3 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 7 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 10 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 15 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 17 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 18 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 21 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 25 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 26 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 29 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 31 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 32 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 34 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 35 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 104 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 113 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 120 |
3 |
3 |
3 |
3 |
3 |
3 |
18 |
| Subject ID 123 |
3 |
3 |
3 |
2 |
3 |
3 |
17 |
| Subject ID 129 |
2 |
3 |
3 |
3 |
3 |
3 |
17 |
| Sum |
56 |
57 |
57 |
56 |
57 |
57 |
340 |
Marginally, there is a statistically significant effect of secondary task engagement (for most Dose/Event combos) on standard deviation of lane deviation (p-values are from paired t-tests within subject/event):
| XM |
1 |
-0.1079823 |
0.6653311 |
19 |
0.47929 |
|
| XM |
2 |
0.3852318 |
1.0004674 |
18 |
0.10234 |
|
| XM |
3 |
0.6290988 |
0.9803059 |
19 |
0.00515 |
** |
| XP |
1 |
0.3818299 |
0.8399112 |
19 |
0.04753 |
* |
| XP |
2 |
0.1759859 |
1.4630276 |
19 |
0.60005 |
|
| XP |
3 |
0.4446652 |
0.8482441 |
19 |
0.02231 |
* |
| YM |
1 |
0.2406506 |
0.9370421 |
19 |
0.26295 |
|
| YM |
2 |
-0.1298222 |
1.3342822 |
19 |
0.67149 |
|
| YM |
3 |
0.4220633 |
0.7426300 |
19 |
0.01324 |
* |
| YP |
1 |
0.4575804 |
0.8007496 |
19 |
0.01274 |
* |
| YP |
2 |
0.5653850 |
1.1621832 |
18 |
0.03902 |
* |
| YP |
3 |
0.3885585 |
0.7604960 |
19 |
0.02594 |
* |
| ZM |
1 |
0.2998543 |
1.0046808 |
19 |
0.19328 |
|
| ZM |
2 |
0.0252731 |
1.0177404 |
19 |
0.91380 |
|
| ZM |
3 |
0.6257512 |
0.8121137 |
19 |
0.00078 |
*** |
| ZP |
1 |
0.4451658 |
1.0555926 |
19 |
0.06603 |
. |
| ZP |
2 |
0.5386620 |
1.0042601 |
19 |
0.01939 |
* |
| ZP |
3 |
0.4225396 |
0.6069259 |
19 |
0.00241 |
** |
Models
Model 1 - Base Model
\[y_{ij} = \beta_0 + \gamma_i + \beta_1 SecTask_{ij} + \beta_2 DoseXM_{ij} + \beta_3 DoseYM_{ij} + \ldots + \epsilon_{ij}\]
- \(y_{ij}\) = Standard Deviation of lane deviation for subject \(i\) at dosing level \(j\)
- \(\gamma_i\) = subject specific random intercept
- \(SecTask_{ij}\) = dummy variable indicating observation measures performance during secondary task (1 = sec task, 0 = control segment)
- \(DoseAA_{ij}\) = dummy variable for dose = “AA” (1 = specified dose, 0 = reference group)
- In our models we will re-define the reference group such that all dose effects are positive
d3cp$Dose_Grp <- relevel(d3cp$DosingLevel, ref = "ZP")
fit <- lmer(data = d3cp, SD.Lane.Deviation ~ Dose_Grp + Experiment + (1 | ID))
fit_sum <- summary(fit)
kable(round(fit_sum$coefficients, 4))
| (Intercept) |
0.4598 |
0.0853 |
171.3511 |
5.3935 |
0.0000 |
| Dose_GrpXM |
0.0154 |
0.1012 |
655.1849 |
0.1522 |
0.8790 |
| Dose_GrpXP |
0.0756 |
0.1007 |
654.9280 |
0.7502 |
0.4534 |
| Dose_GrpYM |
0.0873 |
0.1007 |
654.9280 |
0.8665 |
0.3865 |
| Dose_GrpYP |
0.0517 |
0.1012 |
655.1849 |
0.5109 |
0.6096 |
| Dose_GrpZM |
0.0454 |
0.1007 |
654.9280 |
0.4507 |
0.6524 |
| Experiment |
0.3443 |
0.0583 |
654.9280 |
5.9029 |
0.0000 |
kable(round(anova(fit), 4))
| Dose_Grp |
0.6434 |
0.1287 |
5 |
655.0996 |
0.2226 |
0.9528 |
| Experiment |
20.1476 |
20.1476 |
1 |
654.9280 |
34.8437 |
0.0000 |
This model suggests a significant effect of secondary task engagement on standard deviation of lane deviation, but no impact of experimental condition
- A few problems with it:
- Doesn’t adjust for differences in speed
- Skewed distribution of
SD.Lane.Deviation
- Treats all 3 secondary tasks as the same
- It also isn’t looking for effect modification by
Dose_Grp
Model 4- Paired Difference as outcome
fit <- lmer(data = df, diff_SD_lane_pos ~ relevel(DosingLevel, ref = "YM") + factor(EventID) + diff_speed + (1 | SubjectID))
kable(round(summary(fit)$coefficients, 4))
| (Intercept) |
0.1210 |
0.1562 |
211.2718 |
0.7743 |
0.4396 |
| relevel(DosingLevel, ref = “YM”)XM |
0.1231 |
0.1778 |
312.8555 |
0.6922 |
0.4893 |
| relevel(DosingLevel, ref = “YM”)XP |
0.1565 |
0.1769 |
312.6196 |
0.8849 |
0.3769 |
| relevel(DosingLevel, ref = “YM”)YP |
0.2848 |
0.1778 |
312.7221 |
1.6015 |
0.1103 |
| relevel(DosingLevel, ref = “YM”)ZM |
0.1390 |
0.1776 |
312.9546 |
0.7822 |
0.4347 |
| relevel(DosingLevel, ref = “YM”)ZP |
0.2910 |
0.1770 |
312.6593 |
1.6443 |
0.1011 |
| factor(EventID)2 |
-0.0315 |
0.1305 |
315.2556 |
-0.2413 |
0.8095 |
| factor(EventID)3 |
0.2020 |
0.1279 |
314.3777 |
1.5790 |
0.1153 |
| diff_speed |
-0.0004 |
0.0178 |
330.3307 |
-0.0235 |
0.9813 |
kable(round(anova(fit),4))
| relevel(DosingLevel, ref = “YM”) |
3.3992 |
0.6798 |
5 |
312.8148 |
0.7622 |
0.5776 |
| factor(EventID) |
3.6341 |
1.8170 |
2 |
314.1180 |
2.0372 |
0.1321 |
| diff_speed |
0.0005 |
0.0005 |
1 |
330.3307 |
0.0006 |
0.9813 |